package com.chenwei.rabbit.workQueues;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author: chenwei
 * @date: 2021/4/1 18:02
 */
@Component("workCustomer")
public class Customer {
    //value-队列名称   durable-是否持久化   autoDelete-是否自动删除队列
    //消费者1
    @RabbitListener(queuesToDeclare = @Queue(value = "workQueue",durable = "false",autoDelete = "false"))
    public void getMsg1(Person message){
        System.out.println("消费者1接收到的消息："+message);
    }

    //消费者2
    @RabbitListener(queuesToDeclare = @Queue(value = "workQueue",durable = "false",autoDelete = "false"))
    public void getMsg2(Person message){
        System.out.println("消费者2接收到的消息："+message);
    }
}
